package com.ivo.model;

import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;

@Entity
@org.hibernate.annotations.Entity(dynamicUpdate = true)
@Table(name = "PDM_M_MAST_INS")
public class MasterInstance extends Model
{
	private static final long serialVersionUID = -1685979530035324945L;
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "MAST_INS_ID")
	private Long instanceId;

	@Column(name = "VERSION")
	private String version = "00";

	@Column(name = "DATE_ORDER")
	private Date orderDate;

	@Column(name = "REQUISITIONER_FK")
	private String requisitionerId;

	@Column(name = "CONCLUSION")
	private String conclusion;

	@Column(name = "REASON")
	private String reason;

	@Column(name = "DOC_NUMBER")
	private String documentNumber;

	@OneToOne(cascade = { CascadeType.MERGE })
	@JoinColumn(name = "MAST_STAT_FK")
	private Status status;

	@OneToOne(cascade = { CascadeType.MERGE })
	@JoinColumn(name = "CATE_FK")
	private Category category;

	@OneToMany(cascade = { CascadeType.MERGE }, targetEntity = MasterAttributeInstance.class, mappedBy = "masterInstance", fetch = FetchType.LAZY)
	private List<MasterAttributeInstance> mastAttrIns;

	public Long getInstanceId()
	{
		return instanceId;
	}

	public void setInstanceId(Long instanceId)
	{
		this.instanceId = instanceId;
	}

	public String getVersion()
	{
		return version;
	}

	public void setVersion(String version)
	{
		this.version = version;
	}

	public Date getOrderDate()
	{
		return orderDate;
	}

	public void setOrderDate(Date orderDate)
	{
		this.orderDate = orderDate;
	}

	public String getRequisitionerId()
	{
		return requisitionerId;
	}

	public void setRequisitionerId(String requisitionerId)
	{
		this.requisitionerId = requisitionerId;
	}

	public String getConclusion()
	{
		return conclusion;
	}

	public void setConclusion(String conclusion)
	{
		this.conclusion = conclusion;
	}

	public String getReason()
	{
		return reason;
	}

	public void setReason(String reason)
	{
		this.reason = reason;
	}

	public String getDocumentNumber()
	{
		return documentNumber;
	}

	public void setDocumentNumber(String documentNumber)
	{
		this.documentNumber = documentNumber;
	}

	public Status getStatus()
	{
		return status;
	}

	public void setStatus(Status status)
	{
		this.status = status;
	}

	public Category getCategory()
	{
		return category;
	}

	public void setCategory(Category category)
	{
		this.category = category;
	}

	public List<MasterAttributeInstance> getMastAttrIns()
	{
		return mastAttrIns;
	}

	public void setMastAttrIns(List<MasterAttributeInstance> mastAttrIns)
	{
		this.mastAttrIns = mastAttrIns;
	}

}
